import unittest
import requests

from day_01_01 import TpLogin


class TextLogin(unittest.TestCase):
    def test01_login_ok(self):
        login_data1 = {"username": "17671055841",
                       "password": "a123456789a",
                       "verify_code": "8888"}
        res = TpLogin.login_ok(login_data1)
        self.assertEqual(1, res.json().get("status"))
        self.assertIn("登陆成功", res.json().get("msg"))
        print(res.json())

    def test02_mobile_no(self):
        login_data1 = {"username": "17671055544",
                       "password": "a123456789a",
                       "verify_code": "8888"}
        res = TpLogin.login_ok(login_data1)
        self.assertEqual(-1, res.json().get("status"))
        self.assertIn("不存在", res.json().get("msg"))
        print(res.json())

    def test03_pass_no(self):
        login_data1 = {"username": "17671055544",
                       "password": "a123456789a",
                       "verify_code": "8888"}
        res = TpLogin.login_ok(login_data1)
        self.assertEqual(-1, res.json().get("status"))
        self.assertIn("不存在", res.json().get("msg"))
        print(res.json())
